<%@ page import="java.util.*, database.*, java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		
		<%
                DBCon db = new DBCon();
                
		String title = "Professor Registration - SPMS";
                
                String control = db.getControlValue("professor_reg");
		%>
		<title><%=title%></title>
		<link href="css/stylesheet.css" rel="stylesheet" type="text/css" />
		<%@ include file="../master/head.jsp"%>
		<script src='../js/isUserExist.js'></script>
		<script>
			 function isCorrect(t)
			 {
				 inno = document.getElementById('incorrectFields');
				 if (t.fn.value == '' )					
					 {	inno.innerHTML = 'Invalid First Name';return false;}
				 else if ( t.mn.value == '' )
					 {	inno.innerHTML = 'Invalid Father Name';return false;}
				 else if ( t.ln.value == '' )
					 {	inno.innerHTML = 'Invalid Last Name';return false;}
				 else if ( t.UserName.value == '' )
					 {	inno.innerHTML = 'Invalid Username';return false;}
				 else if ( t.PassWord.value == '' )
					 {	inno.innerHTML = 'Invalid Password';return false;}
				 else if ( t.PassWord.value != t.pwd2.value)
					 {	inno.innerHTML = 'Passwords not matches.';return false;}
				 else if ( !isEmail(t.email.value) )
					 {	inno.innerHTML = 'Invalid Email';return false;}
				 else	
					 return true;
				 
				 
			 }
			 function isEmail(t)
			 {
				 if (t.indexOf('.') > t.indexOf('@')+1 && t.indexOf('@') > 0)
					 return true;
				 else
					 return false;
			 }
		</script>
	</head>
	<body>
		<div id="container">
			<div id="wrapper">
				<div id="sidebar">
					<div id="sb_top"><%@ include file="../master/sbTop.jsp"%>
					</div>
					
					<div class="sb_content"><!--##########--> <!-- Start Menu --> <%@ include
		 file="../master/menu.jsp"%> <!-- Profile --> <%@ include
		 file="../master/profile.jsp"%> <!-- links --> <%@ include
		 file="../master/links.jsp"%>
						<div class="copyright"><%@ include file="../master/copyright.jsp"%>
						</div>
						
					</div>
				<!-- /sb_content --></div>
				<!-- /sideBar --> <!-- Top -->
				<div id="header"><%@ include file="../master/header.jsp"%>
				</div>
				
				
				<!-- Start main content -->
				<div id="content">
					<div id="introduction">
						<h1><%=title%></h1>
						<h2>Student Project Management System</h2>
					</div>
					<!-- /intro -->
					
					<h1>Professor Registration</h1>
                                         <%
                                          if(control.equals("true"))
                                            {
                                         
                                         %>
                                         <center>
                                             
						<form name="login" action="../DB/ProfInsert.jsp" method=post onsubmit="return isCorrect(this)">
							<table border=0>
								<tr>
									<td  class="style1">
									<h2>Professor Information</h2></td>
									<td>
										<div id='incorrectFields' class='required'></div>
									</td>
									
								</tr>
								<tr>
									<td>
										<hr />
									</td>
									<td>
										<hr />
									</td>
								</tr>
								<tr>
									<td class="required" align="left">* Name</td>
									<td align="left"><input type="text" name="fn" size="10" /><input type="text" name="mn" size="10" /><input type="text" name="ln" size="10" /></td>
								</tr>
								<tr>
									<td align="left">Degree</td>
									<td align="left"><select name="deg">
											<option value="Lecturer">Lecturer</option>
											<option value="Assistant">Assistant Professor</option>
											<option value="Associate">Associate Professor</option>
											<option value="Full">Full Professor</option>
									</select></td>
								</tr>
								<tr>
									<td align="left">Department</td>
									<td align="left"><select name="dpt">
											<option value="CS">Computer Science</option>
											<option value="IS">Information Systems</option>
									</select></td>
								</tr>
								<tr>
									<td align="left">Work Phone</td>
									<td align="left"><input type="text" name="wp" size="30" onblur="value = parseInt(value);"/></td>
								</tr>
								
								<tr>
									<td align="left">Mobile Phone</td>
									<td align="left"><input type="text" name="mp" size="30" onblur="value = parseInt(value);"/></td>
								</tr>
								<tr>
									<td class="required" align="left">* Email</td>
									<td align="left"><input type="text" onblur="isEmail(this.value)" name="email" size="30" /></td>
								</tr>
								<tr>
									<td align="left">Home page</td>
									<td align="left"><input type="text" name="hp" size="30" /></td>
								</tr>
								
								<tr>
									<td class="style1">
									<h2>User Account</h2></td>
								</tr>
								<tr>
									<td>
										<hr />
									</td>
									<td>
										<hr />
									</td>
								</tr>
								<tr>
									<td class="required" align="left">* Enrolment</td>
									<td align="left"><input type="text" name="enrol" size="30" /><label></label></td>
								</tr>
								<tr>
									<td class="required" align="left">* Login<div id="isExist"></td>
									<td align="left"><input type="text" name="UserName" size="30" onblur="isExisted(this.value)"/></td>
								</tr>
								
								<tr>
									<td class="required" align="left">* Password</td>
									<td align="left"><input type="password" name="PassWord" size="30" /><label></label></td>
								</tr>
								<tr>
									<td class="required" align="left">* Re-Password</td>
									<td Re-Password align="left"><input type="hidden" name='qwq' value='Before' /> <input
											type="password" name="pwd2" size="30" />
									</td>
								</tr>
								
								<tr>
									<td>
										<hr />
									</td>
									<td>
										<hr />
									</td>
								</tr>
								<tr>
									<td><input type="submit" value="Register" /></td>
								</tr>
							</table>
						</form>
					</center>
                                         
                                         <%
}
else
{
%>
        <br/><br/><center><h2>Registeration is not available</h2></center>
<%}%>
				</div>
				
			<!-- /content --></div>
			<!-- /wrapper -->
			<div class="clear">&nbsp;</div>
		<!-- Important! Fix the problem of height in Firefox --></div>
		<!-- /Container -->

	</body>
</html>